package com.daxue.tcpweb.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.daxue.tcpweb.entity.Question;
import com.daxue.tcpweb.mapper.QuestionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author daxue0929
 * @date 2022/09/17
 **/
@Service
public class QuestionService {

    public final QuestionMapper mapper;

    @Autowired
    public QuestionService(QuestionMapper mapper) {
        this.mapper = mapper;
    }

    public List<Question> searchQuestion(String question) {
        QueryWrapper<Question> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("question", question);

        List<Question> list = mapper.selectList(queryWrapper);
        return list;
    }
}
